package com.df.tv.launcher.exception;

import android.text.TextUtils;

public abstract class TVException extends Exception {
    private static final long serialVersionUID = -2603546001071790940L;

    private int mCode = -1;
    private String mMsg;
    private String mContent;

    public TVException(int code) {
        this.mCode = code;
    }

    public TVException(int code, String msg) {
        this.mCode = code;
        this.mMsg = msg;
    }

    public int getCode() {
        return mCode;
    }

    public void setCode(int code) {
        this.mCode = code;
    }

    public String getMsg() {
        return (TextUtils.isEmpty(mMsg) ? getMsgByCode(mCode) : mMsg);
    }

    public void setMsg(String msg) {
        this.mMsg = msg;
    }

    public String getContent() {
        return mContent;
    }

    public void setContent(String content) {
        this.mContent = content;
    }

    protected abstract String getMsgByCode(int code);

}
